# h-h e-e l-l
# .-h .-e .-l .-2
import re
# .匹配任意单个字符除了\n
# m1 = re.match("..","hello")
# print(m1.group())
# m2 = re.match("..."," 123")
# print(m2.group())
# # m3 = re.match(".h","\nhello")
# m3 = re.match(".h","\nhello",re.S)  # re.S点匹配任意单个字符包括\n
# print(m3.group())  # 报错


# []匹配单个字符 [hH]匹配h或者是H
# m1 = re.match("[hH]ello","hello")
# # m1 = re.match("hello","Hello")
# print(m1.group())
# # m2 = re.match("[0-9]","1")   # [0123456789]相当于[0-9]
# # m2 = re.match("[a-z]","y")  # 匹配小写字母
# m2 = re.match("[A-Z]","H")  # 匹配大写字母
# print(m2.group())
# m3 = re.match("[1-36-8][1-5]","25")  # 1-3或者6-8
# # [a-zA-Z0-9]
# print(m3.group())


# \d匹配数字
# m1 = re.match("\d\d","18岁")
# print(m1.group())
# # \D匹配除了数字以外的(英文，汉字，下划线...)
# m2 = re.match("\d\d\D","18岁")
# print(m2.group())


# \s匹配空白字符(空格，换行，制表符)
# m1 = re.match("\s."," 123")
# print(m1.group())
# m2 = re.match("\s.","\nhello")
# print(m2.group())
# \S匹配不是空白字符(数字、符号、英文...)
# m1 = re.match("\S.","123")
# print(m1.group())
# m2 = re.match("\S.","hello")
# print(m2.group())


# \w匹配中文，英文，数字，下划线
m1 = re.match("\w","123hello")
print(m1.group())
# \W匹配特殊字符($，空格，&)
m2 = re.match("\Whe"," hello")
print(m2.group())

# 单个元字符会和多个元字符以及匹配开头结尾和分组结合使用
